#!/bin/sh
# - interval

. $LKP_SRC/lib/kmemleak.sh
. $LKP_SRC/lib/wait.sh

kmemleak_is_enabled || exit 0

setup_wait

: "${interval:=10}"

# stop automatically scanning thread
echo "scan=off" >/sys/kernel/debug/kmemleak

i=0
while :
do
	echo scan >/sys/kernel/debug/kmemleak
	cat /sys/kernel/debug/kmemleak
	echo clear >/sys/kernel/debug/kmemleak
	if [ $i -le 2 ]; then
		sleep $interval
	else
		wait_timeout $interval
	fi
	i=$((i+1))
done
